home *** CD-ROM | disk | FTP | other *** search
Wrap
global gHotRects, gObjects, sQTCharSprite, gHaveNavs, gCDName, gFileSep, cNUllCharmovie, gSoundchannels on totalCastMem first, last set totalCastMem to 0 repeat with i = first to last set totalCastMem to totalCastMem + (the size of cast i / 1024) end repeat end on jk3 Jumptokey(#G20) end on getRadius if getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj) <> #NULL then if the mouseDown then set counter to 1 if counter = 1 then putRadius() set counter to counter + 1 end if end if end if end on putRadius if getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj) <> #NULL then set xConstrainXOBJ to getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj) end if put "XContrainResult" && xConstrainXOBJ(mWhere, the mouseH, the mouseV) && point(the mouseH, the mouseV) end on setupG20 set xConstrainXOBJ to OffScreen(mnew, string(gCDName & "CODE" & gFileSep & "LabDish.BMP"), 0, 0, 4) setaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj, xConstrainXOBJ) if getaProp(getaProp(gObjects, #GrowSporesLab), #solved) = #true then setaProp(getaProp(gWorld, #G20), #BgName, the number of cast "G20B.PCT") end if end on cleanUpG20 set xConstrainXOBJ to getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj) if objectp(xConstrainXOBJ) then xConstrainXOBJ(mdispose) end if setaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj, #NULL) end on releaseSpores OBJref if getaProp(getaProp(gObjects, #GrowSporesLab), #solved) = #false then set OBj to getaProp(gObjects, OBJref) set sporeList to getaProp(OBj, #Children) set sporesOnPlateList to getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate) repeat with spore in sporeList setSporePlateLoc(spore) updateStage() add(sporesOnPlateList, spore) MakeDynamic(spore, #loc, the loc of sprite getaProp(getaProp(gObjects, spore), #SpriteNum)) end repeat MakeDynamic(#GrowSporesLab, #SporesOnPlate, sporesOnPlateList) end if if count(getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate)) = 6 then DelObjects([#leaf1Obj, #Leaf2Obj]) MakeDynamic(#leaf1Obj, #Aquired, #false) MakeDynamic(#Leaf2Obj, #Aquired, #false) end if end on setSporePlateLoc OBJref set testLoc to #invalid set newSporeSpriteNum to getaProp(getaProp(gObjects, OBJref), #SpriteNum) set newCastNum to getaProp(getaProp(getaProp(gObjects, OBJref), #cast), getaProp(getaProp(gObjects, OBJref), #DisplayState)) set xConstrainXOBJ to getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj) set sporesOnPlateList to getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate) set dishRect to getaProp(getaProp(gObjects, #GrowSporesLab), #dishRect) set the randomSeed to the ticks set randomLocH to the left of dishRect + random(the right of dishRect - the left of dishRect) set randomLocV to the top of dishRect + random(the bottom of dishRect - the top of dishRect) set newSporeRect to rect(randomLocH - the width of cast newCastNum, randomLocV - the height of cast newCastNum, randomLocH + the width of cast newCastNum, randomLocV + the height of cast newCastNum) if count(sporesOnPlateList) = 0 then if xConstrainXOBJ(mWhere, randomLocH, randomLocV) = 0 then set the loc of sprite newSporeSpriteNum to point(randomLocH, randomLocV) else setSporePlateLoc(OBJref) end if else if count(sporesOnPlateList) > 0 then if xConstrainXOBJ(mWhere, randomLocH, randomLocV) = 0 then set testLoc to #valid repeat with oldSpore in sporesOnPlateList set oldSporeSpriteNum to getaProp(getaProp(gObjects, oldSpore), #SpriteNum) if intersect(newSporeRect, the rect of sprite oldSporeSpriteNum) <> rect(0, 0, 0, 0) then set testLoc to #invalid exit repeat end if end repeat end if if testLoc = #valid then set the loc of sprite newSporeSpriteNum to point(randomLocH, randomLocV) else setSporePlateLoc(OBJref) end if end if end if end on GrabDragLabNeedles OBJref set OBj to getaProp(gObjects, OBJref) set moveNeedleFlag to getaProp(getaProp(gObjects, #GrowSporesLab), #moveNeedleFlag) set theChildren to getaProp(OBj, #Children) set cousin to getAt(getaProp(OBj, #Cousins), 1) if (moveNeedleFlag = #true) or (moveNeedleFlag = #noPickUp) then cursor(getaProp(gCursorlist, #Grab)) set lastLocH to the locH of getaProp(OBj, #loc) set lastLocV to the locV of getaProp(OBj, #loc) set SpriteNum to getaProp(OBj, #SpriteNum) set dishCenter to the loc of sprite 1 set dishConstrainRadius to 112 set xConstrainXOBJ to getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj) set H to the mouseH set V to the mouseV set OffsetH to H - the locH of sprite SpriteNum set OffsetV to V - the locV of sprite SpriteNum set loopCount to 0 if xConstrainXOBJ(mWhere, H, V) = 0 then set myGrab to 0 else set myGrab to 1 end if repeat while the stillDown set lastLoc to the loc of sprite SpriteNum set H to the mouseH set V to the mouseV if xConstrainXOBJ(mWhere, H - OffsetH, V - OffsetV) = 0 then set the locV of sprite SpriteNum to V - OffsetV set the locH of sprite SpriteNum to H - OffsetH else set mouseLocRadius to power(power(the mouseH - the locH of dishCenter, 2) + power(the mouseV - the locV of dishCenter, 2), 0.5) if mouseLocRadius = 0 then set mouseLocRadius to 1 end if set circumH to the locH of dishCenter + (dishConstrainRadius * (the mouseH - the locH of dishCenter) / mouseLocRadius) set circumV to the locV of dishCenter + (dishConstrainRadius * (the mouseV - the locV of dishCenter) / mouseLocRadius) set the loc of sprite SpriteNum to point(circumH, circumV) end if set newRelativeLoc to lastLoc - the loc of sprite SpriteNum repeat with Child in theChildren PullChild(Child, newRelativeLoc) end repeat PullCousin(cousin, point(0, the locV of newRelativeLoc)) if getaProp(getaProp(gObjects, #GrowSporesLab), #moveNeedleFlag) <> #noPickUp then if getaProp(getaProp(gObjects, #GrowSporesLab), #FatherSpore) = #none then GrabSpore(OBJref) else set breeding to BreedOffspring(loopCount) end if if breeding = #true then setaProp(getaProp(gObjects, #GrowSporesLab), #moveNeedleFlag, #false) playSound("G20FailB.aif", #keyframeCast, #NOW) Startthetimer(120, "DissolveOffspring") exit repeat else if breeding = #Ooze then MakeDynamic(#GrowSporesLab, #moveNeedleFlag, #false) playOozeQT() setaProp(getaProp(gStates, #Conditions), #Microscope, #true) MakeDynamic(#GrowSporesLab, #solved, #true) MakeDynamic(#GrowSporesLab, #moveNeedleFlag, #noPickUp) exit repeat end if end if end if CursorandUpdate() set loopCount to loopCount + 1 end repeat dropSpore(OBJref) cursor(getaProp(gCursorlist, #Hand)) updateStage() SetobjLOCRECTG(OBJref) SetobjLOCRECTG(cousin) repeat with Child in theChildren SetobjLOCRECTG(Child) end repeat CursorandUpdate() end if end on playOozeQT setNeedleOozeLocs() Startthetimer(1, "killHotRects") AddObjects([#OozeQT]) Startthetimer(60, "startCleanUpOoze") end on startCleanUpOoze Startthetimer(the stopTime of sprite sQTCharSprite - the movieTime of sprite sQTCharSprite + 15, "cleanUpOoze") end on KillHotRects set tempHotRectList to [:] set tempHotRectList to gHotRects setaProp(getaProp(gObjects, #GrowSporesLab), #tempHotRectList, tempHotRectList) set gHotRects to [:] end on setNeedleOozeLocs set the loc of sprite getaProp(getaProp(gObjects, #LeftNeedle), #SpriteNum) to getaProp(getaProp(gObjects, #LeftNeedle), #OozeLoc) MakeDynamic(#LeftNeedle, #loc, getaProp(getaProp(gObjects, #LeftNeedle), #OozeLoc)) MakeDynamic(#LeftNeedle, #Hotrect, getaProp(getaProp(gObjects, #LeftNeedle), #OozeHOTRECT)) set hotrectnum to integer(getaProp(getaProp(gObjects, #LeftNeedle), #SpriteNum) & "01") setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(getaProp(gObjects, #LeftNeedle), #Hotrect), 1)) set the loc of sprite getaProp(getaProp(gObjects, #LeftKnob), #SpriteNum) to getaProp(getaProp(gObjects, #LeftKnob), #OozeLoc) MakeDynamic(#LeftKnob, #loc, getaProp(getaProp(gObjects, #LeftKnob), #OozeLoc)) MakeDynamic(#LeftKnob, #Hotrect, getaProp(getaProp(gObjects, #LeftKnob), #OozeHOTRECT)) set hotrectnum to integer(getaProp(getaProp(gObjects, #LeftKnob), #SpriteNum) & "01") setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(getaProp(gObjects, #LeftKnob), #Hotrect), 1)) set the loc of sprite getaProp(getaProp(gObjects, #RightNeedle), #SpriteNum) to getaProp(getaProp(gObjects, #RightNeedle), #OozeLoc) MakeDynamic(#RightNeedle, #loc, getaProp(getaProp(gObjects, #RightNeedle), #OozeLoc)) MakeDynamic(#RightNeedle, #Hotrect, getaProp(getaProp(gObjects, #RightNeedle), #OozeHOTRECT)) set hotrectnum to integer(getaProp(getaProp(gObjects, #RightNeedle), #SpriteNum) & "01") setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(getaProp(gObjects, #RightNeedle), #Hotrect), 1)) set the loc of sprite getaProp(getaProp(gObjects, #RightKnob), #SpriteNum) to getaProp(getaProp(gObjects, #RightKnob), #OozeLoc) MakeDynamic(#RightKnob, #loc, getaProp(getaProp(gObjects, #RightKnob), #OozeLoc)) MakeDynamic(#RightKnob, #Hotrect, getaProp(getaProp(gObjects, #RightKnob), #OozeHOTRECT)) set hotrectnum to integer(getaProp(getaProp(gObjects, #RightKnob), #SpriteNum) & "01") setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(getaProp(gObjects, #RightKnob), #Hotrect), 1)) updateStage() end on cleanUpOoze sendSporesNorth() set the castNum of sprite 1 to the number of cast "G20B.PCT" updateStage() DelObjects([#OozeQT]) set gHotRects to getaProp(getaProp(gObjects, #GrowSporesLab), #tempHotRectList) AddTubetoUnv() MakeDynamic(#OozeQT, #DisplayState, #OffScreen) end on sendSporesNorth set SporesOnPlate to getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate) repeat with sporeRef in SporesOnPlate set the loc of sprite getaProp(getaProp(gObjects, sporeRef), #SpriteNum) to point(-2000, -2000) MakeDynamic(sporeRef, #loc, point(-2000, -2000)) end repeat MakeDynamic(#GrowSporesLab, #SporesOnPlate, []) end on GrabSpore OBJref set OBj to getaProp(gObjects, OBJref) set needleSpriteNum to getaProp(OBj, #SpriteNum) set SporesOnPlate to getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate) if getaProp(OBj, #Children) <> [] then exit end if repeat with sporeRef in SporesOnPlate set sporeSpriteNum to getaProp(getaProp(gObjects, sporeRef), #SpriteNum) if inside(the loc of sprite needleSpriteNum, the rect of sprite sporeSpriteNum) then add(getaProp(OBj, #Children), sporeRef) setaProp(getaProp(gObjects, #GrowSporesLab), #FatherSpore, sporeRef) playSound("G20jab.aif", #keyframeCast) exit end if end repeat end on dropSpore OBJref set OBj to getaProp(gObjects, OBJref) setaProp(OBj, #Children, []) setaProp(getaProp(gObjects, #GrowSporesLab), #FatherSpore, #none) setaProp(getaProp(gObjects, #GrowSporesLab), #motherSpore, #none) end on BreedOffspring inCount set fatherSporeRef to getaProp(getaProp(gObjects, #GrowSporesLab), #FatherSpore) set fatherSporeSpriteNum to getaProp(getaProp(gObjects, fatherSporeRef), #SpriteNum) set SporesOnPlate to getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate) set lastMotherSpore to getaProp(getaProp(gObjects, #GrowSporesLab), #motherSpore) repeat with motherSporeRef in SporesOnPlate set motherSporeSpriteNum to getaProp(getaProp(gObjects, motherSporeRef), #SpriteNum) if (motherSporeRef <> fatherSporeRef) and (intersect(the rect of sprite fatherSporeSpriteNum, the rect of sprite motherSporeSpriteNum) <> rect(0, 0, 0, 0)) then if inCount = 1 then set lastMotherSpore to motherSporeRef setaProp(getaProp(gObjects, #GrowSporesLab), #motherSpore, lastMotherSpore) end if if motherSporeRef <> lastMotherSpore then setaProp(getaProp(gObjects, #GrowSporesLab), #motherSpore, motherSporeRef) if ((fatherSporeRef <> #spore5) and (fatherSporeRef <> #spore6)) or ((motherSporeRef <> #spore5) and (motherSporeRef <> #spore6)) then set fatherIndex to char 6 of string(fatherSporeRef) set motherIndex to char 6 of string(motherSporeRef) if fatherIndex < motherIndex then set offspringCastName to "G20spr" & string(fatherIndex) & string(motherIndex) & ".pct" else set offspringCastName to "G20spr" & string(motherIndex) & string(fatherIndex) & ".pct" end if set offspringCastNum to the number of cast offspringCastName set numberOffspring to 10 + random(10) birthOffspring(offspringCastNum, numberOffspring, fatherSporeSpriteNum, motherSporeSpriteNum) return #true next repeat end if return #Ooze end if end if end repeat return #false end on birthOffspring inCastNum, numberOffspring, fatherSporeSpriteNum, motherSporeSpriteNum set firstOffspringSpriteNum to getaProp(getaProp(gObjects, #SporeOffspring1), #SpriteNum) set motherLoc to the loc of sprite motherSporeSpriteNum set growRect to rect(the locH of motherLoc - 140, the locV of motherLoc - 140, the locH of motherLoc + 140, the locV of motherLoc + 140) set offspringWidth to the width of cast inCastNum set offspringHeight to the height of cast inCastNum repeat with i = firstOffspringSpriteNum to firstOffspringSpriteNum + numberOffspring set pointFlag to 0 set the castNum of sprite i to inCastNum repeat while pointFlag = 0 set newLoc to setOffspringPlateLoc(i, offspringWidth, offspringHeight, growRect, motherLoc) if ilk(newLoc, #point) then set the loc of sprite i to newLoc set pointFlag to 1 set failSoundChannel to playSound("G20failC.aif", #keyframeCast, #NOW) waitForSoundDone(failSoundChannel) stopsound("G20failC.aif") end if end repeat updateStage() add(getaProp(getProp(gObjects, #GrowSporesLab), #OffspringOnPlate), i) end repeat end on setOffspringPlateLoc SpriteNum, offspringWidth, offspringHeight, growRect, motherLoc set xConstrainOffspringXOBJ to getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj) set sporeRefsOnPlate to getaProp(getProp(gObjects, #GrowSporesLab), #SporesOnPlate) set offspringSpritesOnPlate to getaProp(getProp(gObjects, #GrowSporesLab), #OffspringOnPlate) set the randomSeed to the ticks set randomswitch to random(11) if randomswitch <= 7 then set randomOffsetH to random(25) else if randomswitch < 10 then set randomOffsetH to 25 + random(50) else set randomOffsetH to 50 + random(100) end if end if set randomswitch to random(11) if randomswitch <= 7 then set randomOffsetV to random(25) else if randomswitch < 10 then set randomOffsetV to 25 + random(50) else set randomOffsetV to 50 + random(100) end if end if set the randomSeed to the ticks if random(2) = 1 then set randomLocH to the locH of motherLoc + randomOffsetH else set randomLocH to the locH of motherLoc - randomOffsetH end if if random(2) = 1 then set randomLocV to the locV of motherLoc + randomOffsetV else set randomLocV to the locV of motherLoc - randomOffsetV end if set spriteTestRect to rect(randomLocH - integer(offspringWidth / 8), randomLocV - integer(offspringHeight / 8), randomLocH + integer(offspringWidth / 8), randomLocV + integer(offspringHeight / 8)) if xConstrainOffspringXOBJ(mWhere, randomLocH, randomLocV) = 0 then if testSporeLocs(sporeRefsOnPlate, SpriteNum, spriteTestRect) then if testOffspringLocs(offspringSpritesOnPlate, SpriteNum, spriteTestRect) then return point(randomLocH, randomLocV) end if end if end if end on testSporeLocs sporeRefsOnPlate, SpriteNum, thisSpriteTestRect set testFlag to 1 repeat with sporeRef in sporeRefsOnPlate set sporeSpriteNum to getaProp(getaProp(gObjects, sporeRef), #SpriteNum) if intersect(the rect of sprite sporeSpriteNum, thisSpriteTestRect) <> rect(0, 0, 0, 0) then set testFlag to 0 exit repeat end if end repeat return testFlag end on testOffspringLocs offspringSpritesOnPlate, thisOffspringSpriteNum, thisSpriteTestRect set testFlag to 1 if count(offspringSpritesOnPlate) > 0 then repeat with checkOffSpringSpriteNum in offspringSpritesOnPlate if intersect(the rect of sprite checkOffSpringSpriteNum, thisSpriteTestRect) <> rect(0, 0, 0, 0) then set testFlag to 0 exit repeat end if end repeat end if return testFlag end on DissolveOffspring set offspringOnPlateList to getaProp(getaProp(gObjects, #GrowSporesLab), #OffspringOnPlate) repeat with offspringSpriteNum in offspringOnPlateList set the loc of sprite offspringSpriteNum to point(-1000, -1000) end repeat puppetTransition(51, 8, 8, 1) setaProp(getaProp(gObjects, #GrowSporesLab), #OffspringOnPlate, []) setaProp(getaProp(gObjects, #GrowSporesLab), #moveNeedleFlag, #true) end on AddTubetoUnv if getaProp(getaProp(gObjects, #TubeObj), #Aquired) = #false then MakeDynamic(#TubeObj, #Aquired, #true) AddObjects([#TubeObj]) end if end on PullCousin OBJref, Distance set OBj to getaProp(gObjects, OBJref) set the loc of sprite getaProp(OBj, #SpriteNum) to the loc of sprite getaProp(OBj, #SpriteNum) - Distance end on SetobjLOCRECTG OBJref set OBj to getaProp(gObjects, OBJref) if voidp(OBJref) then exit end if MakeDynamic(OBJref, #loc, the loc of sprite getaProp(OBj, #SpriteNum)) if not voidp(getaProp(OBj, #Hotrect)) then set hotrectnum to integer(getaProp(OBj, #SpriteNum) & "01") set newHotRectList to [] setAt(newHotRectList, 1, the rect of sprite getaProp(OBj, #SpriteNum)) MakeDynamic(OBJref, #Hotrect, newHotRectList) setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(OBj, #Hotrect), 1)) end if end on PullChildUPdateG OBJref set OBj to getaProp(gObjects, OBJref) MakeDynamic(OBJref, #loc, the loc of sprite getaProp(OBj, #SpriteNum)) if not voidp(getaProp(OBj, #Hotrect)) then set hotrectnum to integer(getaProp(OBj, #SpriteNum) & "01") set newHotRectList to [] setAt(newHotRectList, 1, the rect of sprite getaProp(OBj, #SpriteNum)) MakeDynamic(OBJref, #Hotrect, newHotRectList) setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(OBj, #Hotrect), 1)) end if if not voidp(getaProp(OBj, #Children)) then set theChildren to getaProp(OBj, #Children) repeat with Child in theChildren PullChildUPdateG(Child) end repeat end if end on ConstDragG OBJref set OBj to getaProp(gObjects, OBJref) set DirConst to getaProp(OBj, #DirConst) set ConstMax to getaProp(OBj, #ConstMax) set ConstMin to getaProp(OBj, #ConstMin) if not voidp(getaProp(OBj, #Children)) then set theChildren to getaProp(OBj, #Children) end if cursor(getaProp(gCursorlist, #Grab)) updateStage() set OffsetV to the mouseV - the locV of sprite getaProp(OBj, #SpriteNum) repeat while the stillDown set V to the mouseV - OffsetV if (V < ConstMax) and (V > ConstMin) then repeat with Child in theChildren set Distance to the locV of sprite getaProp(OBj, #SpriteNum) - V PullChild(Child, point(0, Distance)) end repeat set the locV of sprite getaProp(OBj, #SpriteNum) to V if not voidp(getaProp(getaProp(OBj, #Action), #WhileDown)) then do(string(getaProp(getaProp(OBj, #Action), #WhileDown) & "(#" & OBJref & ")")) end if CursorandUpdate() end if end repeat cursor(getaProp(gCursorlist, #Hand)) updateStage() SetobjLOCRECTG(OBJref) repeat with Child in theChildren PullChildUPdateG(Child) end repeat CursorandUpdate() end on PullChild OBJref, Distance set OBj to getaProp(gObjects, OBJref) set the loc of sprite getaProp(OBj, #SpriteNum) to the loc of sprite getaProp(OBj, #SpriteNum) - Distance if not voidp(getaProp(OBj, #Children)) then set theChildren to getaProp(OBj, #Children) repeat with Child in theChildren PullChild(Child, Distance) end repeat end if end